# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[DirItem.__init__(self, wymedia_resource, type_, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b6d4c>}
nname: 6
n 6(None)[__doc__ = "Network resource container.\n    Under the hood, it's an OPML <outline> element.\n    "
def __init__(self, wymedia_resource, type_='net_dir', **kw):
	DirItem.__init__(self, wymedia_resource, type_, **kw)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76b682c>}
nname: 0
n 0(None)[display_type = wymedia_resource.get('favicon', None)
DirItem.__init__(self, wymedia_resource, type_=type_, display_type=display_type, **kw)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b6f0c>}
nname: 6
n 6(None)[__doc__ = 'Actual RSS feed. Contains news items (NetItem instances).\n\n    Basically a read-only DirItem that uses\n    a favicon as its display_type (or does it?).\n    '
def __init__(self, wymedia_resource, type_='net_feed', **kw):
	display_type = wymedia_resource.get('favicon', None)
	DirItem.__init__(self, wymedia_resource, type_=type_, display_type=display_type, **kw)
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76b696c>}
nname: 123
n 123(None)[return None
]:
	i: 50(JA), 92(JA), 119(), 122()
	o: 

nname: 122
n 122(None)[]:
	i: 0(f)
	o: 123()

nname: 119
n 119(None)[]:
	i: 117(AE)
	o: 123()

nname: 117
n 117(None)[]:
	i: 82(f)
	o: 119(AE)

nname: 92
n 92(None)[#, e
log.error('Unable to spawn NetPlayer: %r', e)
]:
	i: 82(t)
	o: 123(JA)

nname: 82
n 82(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 46(except)
	o: 92(t), 117(f)

nname: 50
n 50(None)[from pygui.menu.players.net_player import NetPlayer
NetItem.player = NetPlayer()
]:
	i: 46(try)
	o: 123(JA)

nname: 46
n 46(None)[]:
	i: 0(t)
	o: 50(try), 82(except)

nname: 0
n 0(NetItem.player is None)[MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
]:
	i: 
	o: 46(t), 122(f)

nname: 123
n 123(None)[return None
]:
	i: 50(JA), 92(JA), 82(f), 117(AE), 0(f)
	o: 

nname: 92
n 92(None)[#, e
log.error('Unable to spawn NetPlayer: %r', e)
]:
	i: 82(t)
	o: 123(JA)

nname: 82
n 82(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 46(except)
	o: 92(t), 123(f)

nname: 50
n 50(None)[from pygui.menu.players.net_player import NetPlayer
NetItem.player = NetPlayer()
]:
	i: 46(try)
	o: 123(JA)

nname: 46
n 46(None)[]:
	i: 0(t)
	o: 50(try), 82(except)

nname: 0
n 0(NetItem.player is None)[MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
]:
	i: 
	o: 46(t), 123(f)

nname: 123
n 123(None)[return None
]:
	i: 82(f), 0(f)
	o: 

nname: 82
n 82(None)[except Exception, e:
	log.error('Unable to spawn NetPlayer: %r', e)
]:
	i: 46()
	o: 123(JA)

nname: 46
n 46(None)[try:
	from pygui.menu.players.net_player import NetPlayer
	NetItem.player = NetPlayer()
]:
	i: 0(t)
	o: 82()

nname: 0
n 0(NetItem.player is None)[MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
]:
	i: 
	o: 46(t), 123(f)

nname: 123
n 123(None)[return None
]:
	i: 46(f), 0(f)
	o: 

nname: 46
n 46(None)[try:
	from pygui.menu.players.net_player import NetPlayer
	NetItem.player = NetPlayer()
except Exception, e:
	log.error('Unable to spawn NetPlayer: %r', e)
]:
	i: 0(t)
	o: 123(JA)

nname: 0
n 0(NetItem.player is None)[MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
]:
	i: 
	o: 46(t), 123(f)

nname: 0
n 0(None)[MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
if NetItem.player is None:
	try:
		from pygui.menu.players.net_player import NetPlayer
		NetItem.player = NetPlayer()
	except Exception, e:
		log.error('Unable to spawn NetPlayer: %r', e)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b9c2c>}
nname: 0
n 0(None)[items = self.parent.browse()
self.player.play(self, items)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b932c>}
nname: 0
n 0(None)[forged_item = AudioItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
forged_item.player.play(forged_item, [forged_item])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b9c2c>}
nname: 0
n 0(None)[forged_item = VideoItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
forged_item.player.play(forged_item, [forged_item])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b974c>}
nname: 0
n 0(None)[forged_item = ImageItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
forged_item.player.play(forged_item, [forged_item])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b93ac>}
nname: 6
n 6(None)[__doc__ = 'Network resource of some sort. Has an embedded URI that the user\n    can attempt to read as any standard wymedia type (audio, video, image...).\n\n    Of course, since the URI only has one type, only one of play_as_audio(),\n    play_as_video() and play_as_image() will work -- the other two will display\n    an error dialog.\n\n    The standard play() method launches the NetPlayer (text+thumbnail+metadata\n    visualization).\n\n    TODO Automatically play the item as the correct type (requires extra\n    metadata).\n    '
player = None
media_update_fields = ()
def __init__(self, wymedia_resource, type_='net', menu=None, **kw):
	MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
	if NetItem.player is None:
		try:
			from pygui.menu.players.net_player import NetPlayer
			NetItem.player = NetPlayer()
		except Exception, e:
			log.error('Unable to spawn NetPlayer: %r', e)
	return None

def execute(self):
	items = self.parent.browse()
	self.player.play(self, items)

def play_embedded_audio(self):
	forged_item = AudioItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
	forged_item.player.play(forged_item, [forged_item])

def play_embedded_video(self):
	forged_item = VideoItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
	forged_item.player.play(forged_item, [forged_item])

def play_embedded_image(self):
	forged_item = ImageItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
	forged_item.player.play(forged_item, [forged_item])

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76b6f4c>}
nname: 0
n 0(None)[__doc__ = 'Network items (RSS-based web services).'
from __future__ import absolute_import
from peewee.debug import GET_LOGGER
from pygui.item.mediaitem.audiovideo import AudioItem, VideoItem, ImageItem
from pygui.item.mediaitem.core import MediaItem, DirItem
log = GET_LOGGER(__name__)
class NetDirItem(DirItem):
	__doc__ = "Network resource container.\n    Under the hood, it's an OPML <outline> element.\n    "
	def __init__(self, wymedia_resource, type_='net_dir', **kw):
		DirItem.__init__(self, wymedia_resource, type_, **kw)



class NetFeedItem(DirItem):
	__doc__ = 'Actual RSS feed. Contains news items (NetItem instances).\n\n    Basically a read-only DirItem that uses\n    a favicon as its display_type (or does it?).\n    '
	def __init__(self, wymedia_resource, type_='net_feed', **kw):
		display_type = wymedia_resource.get('favicon', None)
		DirItem.__init__(self, wymedia_resource, type_=type_, display_type=display_type, **kw)
		return None



class NetItem(MediaItem):
	__doc__ = 'Network resource of some sort. Has an embedded URI that the user\n    can attempt to read as any standard wymedia type (audio, video, image...).\n\n    Of course, since the URI only has one type, only one of play_as_audio(),\n    play_as_video() and play_as_image() will work -- the other two will display\n    an error dialog.\n\n    The standard play() method launches the NetPlayer (text+thumbnail+metadata\n    visualization).\n\n    TODO Automatically play the item as the correct type (requires extra\n    metadata).\n    '
	player = None
	media_update_fields = ()
	def __init__(self, wymedia_resource, type_='net', menu=None, **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
		if NetItem.player is None:
			try:
				from pygui.menu.players.net_player import NetPlayer
				NetItem.player = NetPlayer()
			except Exception, e:
				log.error('Unable to spawn NetPlayer: %r', e)
		return None

	def execute(self):
		items = self.parent.browse()
		self.player.play(self, items)

	def play_embedded_audio(self):
		forged_item = AudioItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
		forged_item.player.play(forged_item, [forged_item])

	def play_embedded_video(self):
		forged_item = VideoItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
		forged_item.player.play(forged_item, [forged_item])

	def play_embedded_image(self):
		forged_item = ImageItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
		forged_item.player.play(forged_item, [forged_item])



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76aca4c>}
__doc__ = 'Network items (RSS-based web services).'
from __future__ import absolute_import
from peewee.debug import GET_LOGGER
from pygui.item.mediaitem.audiovideo import AudioItem, VideoItem, ImageItem
from pygui.item.mediaitem.core import MediaItem, DirItem
log = GET_LOGGER(__name__)
class NetDirItem(DirItem):
	__doc__ = "Network resource container.\n    Under the hood, it's an OPML <outline> element.\n    "
	def __init__(self, wymedia_resource, type_='net_dir', **kw):
		DirItem.__init__(self, wymedia_resource, type_, **kw)



class NetFeedItem(DirItem):
	__doc__ = 'Actual RSS feed. Contains news items (NetItem instances).\n\n    Basically a read-only DirItem that uses\n    a favicon as its display_type (or does it?).\n    '
	def __init__(self, wymedia_resource, type_='net_feed', **kw):
		display_type = wymedia_resource.get('favicon', None)
		DirItem.__init__(self, wymedia_resource, type_=type_, display_type=display_type, **kw)
		return None



class NetItem(MediaItem):
	__doc__ = 'Network resource of some sort. Has an embedded URI that the user\n    can attempt to read as any standard wymedia type (audio, video, image...).\n\n    Of course, since the URI only has one type, only one of play_as_audio(),\n    play_as_video() and play_as_image() will work -- the other two will display\n    an error dialog.\n\n    The standard play() method launches the NetPlayer (text+thumbnail+metadata\n    visualization).\n\n    TODO Automatically play the item as the correct type (requires extra\n    metadata).\n    '
	player = None
	media_update_fields = ()
	def __init__(self, wymedia_resource, type_='net', menu=None, **kw):
		MediaItem.__init__(self, wymedia_resource, type_=type_, menu=menu, **kw)
		if NetItem.player is None:
			try:
				from pygui.menu.players.net_player import NetPlayer
				NetItem.player = NetPlayer()
			except Exception, e:
				log.error('Unable to spawn NetPlayer: %r', e)
		return None

	def execute(self):
		items = self.parent.browse()
		self.player.play(self, items)

	def play_embedded_audio(self):
		forged_item = AudioItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
		forged_item.player.play(forged_item, [forged_item])

	def play_embedded_video(self):
		forged_item = VideoItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
		forged_item.player.play(forged_item, [forged_item])

	def play_embedded_image(self):
		forged_item = ImageItem(self.name, menu=self.menu, parent=self, uri=self['uri'], backend='dummy')
		forged_item.player.play(forged_item, [forged_item])



